﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace mytool
{
    public partial class FormMain : Form
    {
        public FormMain()
        {
            InitializeComponent();

            // 默认显示文本处理功能。
            windows0.Show();
            groupBox_Form_Main_work.Controls.Clear();
            groupBox_Form_Main_work.Controls.Add(windows0);

            button_check(0);
        }

        // 声明功能按钮
        public windows_text_process windows0 = new windows_text_process();
        public windows_tts windows1 = new windows_tts();
        public windows_name windows2 = new windows_name();

        // 按钮点击事件 -> 文本处理
        private void button_text_process_Click(object sender, EventArgs e)
        {
            windows0.Show();
            groupBox_Form_Main_work.Controls.Clear();
            groupBox_Form_Main_work.Controls.Add(windows0);
            button_check(0);
        }

        // 按钮点击事件 -> 文本转语音
        private void button_tts_Click(object sender, EventArgs e)
        {
            windows1.Show();
            groupBox_Form_Main_work.Controls.Clear();
            groupBox_Form_Main_work.Controls.Add(windows1);
            button_check(1);
        }

        // 按钮点击事件 -> 名称处理
        private void button_name_Click(object sender, EventArgs e)
        {
            windows2.Show();
            groupBox_Form_Main_work.Controls.Clear();
            groupBox_Form_Main_work.Controls.Add(windows2);
            button_check(2);
        }
        // 选中按钮
        private void button_check(int index)
        {
            if (index == 0) { button_text_process.BackColor = Color.FromArgb(100, 149, 237, 0); } else { button_text_process.BackColor = Color.FromArgb(60, 179, 113, 0); }
            if (index == 1) { button_tts.BackColor = Color.FromArgb(100, 149, 237, 0); } else { button_tts.BackColor = Color.FromArgb(60, 179, 113, 0); }
            if (index == 2) { button_name.BackColor = Color.FromArgb(100, 149, 237, 0); } else { button_name.BackColor = Color.FromArgb(60, 179, 113, 0); }

        }

        // 关闭窗口
        private void close_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("关闭当前窗口？", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (result == DialogResult.Yes)
            {
                //关闭当前窗口
                //this.Close();
                //关闭程序
                Application.Exit();
            }
        }

    }
}
